console.log('promise')
// let p1 = new Promise((resolve) => {
//     // resolve('123')
//     return 123
// })

let p1 = new Promise((resolve) => {
    resolve('123')
    return 123
}).then(item => {
    return 234
})
// resolve会触发then执行。
p1.then(cb => {
    console.log('callback' + cb)
})
// reject触发catch方法。
let p2 = Promise.resolve('reject').then(item => {
    console.log(item)
    // throw new Error('callbackerror')
    return 123
})
p2.then(item => {
    console.log(item)
}).catch(reject => {
    console.log(reject)
})